Skip to content

[Key Vault] az keyvault create: Support new Managed HSM SKUs Standard_B1v2, Standard_B5v2, Standard_B10v2, Standard_B15v2, Standard_B20v2 - #34234

Open
neerjagangwar wants to merge 19 commits into
Azure:devfrom
neerjagangwar:keyvault/mgmt-keyvault-2026-05-15
Open

neerjagangwar wants to merge 19 commits into
Azure:devfrom
neerjagangwar:keyvault/mgmt-keyvault-2026-05-15

Conversation

@neerjagangwar

@neerjagangwar neerjagangwar commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests Suppressions
️✔️ None ️✔️ 130/130 ️✔️ None

Related command

  • az keyvault create --hsm-name ... --sku ...
  • All az keyvault control-plane commands
  • az keyvault list, az vm secret format, az sf cluster create --secret-identifier (vault lookup paging, see below)

Description

Bump azure-mgmt-keyvault from 14.0.1 to 14.1.0. This moves the Key Vault control plane to API version 2026-05-15.

Customer impact

  • az keyvault create --hsm-name accepts the new Managed HSM SKUs Standard_B1v2, Standard_B5v2, Standard_B10v2, Standard_B15v2 and Standard_B20v2. The service rejects these on the older API version.
  • The --sku help text lists the new SKUs. The default is still Standard_B1.
  • No breaking changes.

Files changed

File Change
pyproject.toml, requirements.py3.{Darwin,Linux,windows}.txt Pin azure-mgmt-keyvault==14.1.0
keyvault/_params.py Update --sku help text
servicefabric/custom.py Pass family='A' when creating a Key Vault
keyvault/_validators.py, keyvault/custom.py, vm/_validators.py, servicefabric/custom.py, servicefabric/_client_factory.py Use api-version 2015-11-01 for the vaults.list() lookups (see below)
azure-cli-testsdk/.../utilities.py, base.py New MSGraphUserProfileReplacer recording processor (see below)
keyvault/tests/.../test_keyvault_commands.py New-SKU unit test and live scenario (see Testing)
eventhubs, servicebus, sql, mysql, network, storage, vm tests Small test fixes so the dependent scenarios can be re-recorded live (see Recordings)

ServiceFabric fix: family is required by the SDK in both 14.0.1 and 14.1.0. Without it, creating a Key Vault fails client-side before any request is sent. The Key Vault module already passes it.

Test SDK: sanitize Microsoft Graph user profiles. Tests that call az ad signed-in-user show or resolve assignees record the signed-in user's Graph profile. EmailAddressReplacer only masks the email, so names, phone numbers, job title and office location were being committed in recordings. The new processor runs by default for every ScenarioTest:

  • it clears contact fields (phones, job title, office location, address) on any Graph user object;
  • it replaces the signed-in user's display name, given name and surname, learned from /me, with Test User / Test / User in all later responses.

Workaround for an azure-mgmt-keyvault 14.1.0 regression. vaults.list() calls ARM /resources. Page 1 uses 2015-11-01, but in 14.1.0 the next-link pages use the client's api-version (2026-05-15), which ARM rejects with a 400. 14.0.1 had fixed this (Azure/azure-sdk-for-python#45955), but the 14.1.0 regeneration dropped the fix. The CLI creates the client for these lookups with api_version='2015-11-01'. This affects az keyvault list (no -g), az keyvault ... --name without -g, az vm secret format, the default CVM release-policy lookup, and az sf cluster create --secret-identifier. Verified live with one vault per page: az keyvault list (7 pages) and az vm secret format (20 pages) send 2015-11-01 on every page; unpinned, page 2 returns 400. The workaround will be removed once a fixed SDK ships.

References: Azure SDK Release Plan 36121. Spec PR: Azure/azure-rest-api-specs#46950.

Testing Guide

az keyvault create --hsm-name myhsm -g myrg -l <region> --sku Standard_B1v2 --administrators <oid> --retention-days 7
az keyvault show --hsm-name myhsm --query sku

New tests in keyvault/tests/latest/test_keyvault_commands.py:

  • CreateHsmV2SkuTest: unit test; the request body has sku={name, family:'B'} for all five v2 SKUs.
  • test_keyvault_hsm_v2_sku: recorded live in eastus2euap (v2 SKUs are not yet available in most public regions). Standard_B1v2 create, show and list with sku.name / sku.family checks, then delete and purge. Error cases: invalid SKU (400 from the service) and missing --administrators.
  • test_keyvault_hsm_mgmt is unchanged and still covers the default Standard_B1.

Recordings: 53 cassettes were re-recorded live against 2026-05-15, not hand-edited. All of them pass in playback, and no changed recording references 2026-02-01. Every cassette went through the new profile sanitizer and azdev scan.

Module Count
keyvault 21
vm 12
network 5
acs, sql, storage 2 each
appconfig, backup, batch, eventhubs, mysql, netappfiles, search, servicebus, servicefabric 1 each

Not re-recorded (18). These keep their existing recordings. Only the api-version of their Microsoft.KeyVault request URIs was changed to 2026-05-15; response bodies are unchanged. Requests made through az resource update keep the version they resolved from the recorded provider metadata.

Test(s) Reason
vm/vmss_disk_encryption_with_identity ×6 Feature ADEWithManagedIdentity needs allow-listing
vmss_disk_encryption_e2e Azure Disk Encryption scenario; not re-run
disk_encryption_set_identity Tenant policy blocks the Graph app creation the test needs
ams_encryption_set_show, servicefabric ×4 Test creates a Storage v1 account (AccountKindNotSupported); AMS is retired
network_express_route_port Creates a real ExpressRoute Direct port; not run
vpn_connection_authentication NonAzSkusNotAllowedForVPNGateway (test needs an AZ gateway SKU)
bicep ×2 Live run records the ~180 MB bicep binary download
keyvault_hsm_key_release_policy Only the ARM HSM lookup was refreshed; data-plane calls unchanged

History Notes

[Key Vault] az keyvault create: Support new Managed HSM SKUs Standard_B1v2, Standard_B5v2, Standard_B10v2, Standard_B15v2, Standard_B20v2
[ServiceFabric] az sf cluster create, az sf application certificate add: Fix creating a new Key Vault failing due to missing SKU family

This checklist is used to make sure that common guidelines for a pull request are followed.

neerja581 and others added 4 commits October 11, 2026 15:56
…ged HSM SKUs

Upgrades `azure-mgmt-keyvault` 14.0.1 -> 14.1.0 so all `az keyvault`
control-plane operations target ARM API version `2026-05-15`.

API version `2026-05-15` adds five new Managed HSM SKUs:
`Standard_B1v2`, `Standard_B5v2`, `Standard_B10v2`, `Standard_B15v2`
and `Standard_B20v2`. These cannot be used today because the CLI is
pinned to `2026-02-01`, where the resource provider rejects them.

Changes:
- `setup.py` + `requirements.py3.{Darwin,Linux,windows}.txt`:
  `azure-mgmt-keyvault==14.1.0` (its default api-version is `2026-05-15`).
  `MGMT_KEYVAULT` is unpinned in `AZURE_API_PROFILES`, so the client rides
  the SDK default and no profile change is needed.
- `keyvault/_params.py`: add the five new SKUs to the `az keyvault create`
  `--sku` help text, which still listed only the pre-existing five.

No code change is needed in `create_hsm`: `sku_family` is derived as
`sku.split('_')[1][0]`, which yields `B` for all five new SKU names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
…ects in recordings

Clear contact fields (phones, job title, office location, address) on Graph user objects and replace the signed-in user's names learned from /me with mock values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
Copilot AI balanced review requested due to automatic review settings October 16, 2026 14:26
@neerjagangwar
neerjagangwar requested review from a team as code owners October 16, 2026 14:26
@microsoft-github-policy-service microsoft-github-policy-service Bot added Auto-Assign Auto assign by bot KeyVault az keyvault act-identity-squad Service Fabric az sf act-observability-squad Graph (doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad Batch az batch NetAppFiles az netappfiles act-quality-productivity-squad labels Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved playback incompatibilities and sanitizer correctness gaps can break tests and retain personal names.

3 open findings
What changed in this PR

Updates Key Vault management support for the new Managed HSM SKUs and improves test-recording sanitization.

Changes:

  • Bumps azure-mgmt-keyvault to 14.1.0 and expands SKU help.
  • Supplies the required SKU family when Service Fabric creates a vault.
  • Refreshes recordings and adds default Graph profile sanitization.
File Description
src/​azure-cli/​setup.py Updates the Key Vault SDK dependency.
src/​azure-cli/​requirements.py3.windows.txt Updates the Windows dependency pin.
src/​azure-cli/​requirements.py3.Linux.txt Updates the Linux dependency pin.
src/​azure-cli/​requirements.py3.Darwin.txt Updates the macOS dependency pin.
src/​azure-cli/​azure/​cli/​command_modules/​servicefabric/​custom.py Adds the required vault SKU family.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_mhsm_private_link_resource.yaml Refreshes HSM private-link recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_secret_soft_delete.yaml Refreshes secret soft-delete recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_public_network_access.yaml Refreshes network-access recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_private_link_resource.yaml Refreshes vault private-link recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_key_rotation.yaml Refreshes key-rotation recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_hsm_key_random.yaml Refreshes HSM random-data recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​tests/​latest/​recordings/​test_keyvault_certificate_soft_delete.yaml Refreshes certificate soft-delete recording.
src/​azure-cli/​azure/​cli/​command_modules/​keyvault/​_params.py Lists the new HSM SKUs in help.
src/​azure-cli-testsdk/​azure/​cli/​testsdk/​utilities.py Adds Graph user-profile sanitization.
src/​azure-cli-testsdk/​azure/​cli/​testsdk/​base.py Registers the sanitizer by default.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/azure-cli-testsdk/azure/cli/testsdk/utilities.py Outdated
Comment thread src/azure-cli/setup.py Outdated
Comment thread src/azure-cli-testsdk/azure/cli/testsdk/utilities.py Outdated
…project.toml

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

neerja581 and others added 2 commits October 19, 2026 12:47
Only replace decoded JSON string values that exactly match a learned name, so short names cannot corrupt keys/URLs; recognize all built-in cloud Graph hosts; add unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39
Api-version-only updates for Microsoft.KeyVault requests in tests that were not re-recorded, following the approach of Azure#33895.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 272efcb4-b315-43c3-89c0-03a3eac4fa39

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments are inline on the changed lines. See the X Engineering Agent Report.

Comment thread src/azure-cli/pyproject.toml
Comment thread src/azure-cli/azure/cli/command_modules/keyvault/_params.py
… SKU unit test

Re-record cross-module tests that depend on azure-mgmt-keyvault 14.1.0 / API 2026-05-15
live (per doc/authoring_tests.md#recording-tests), and fix outdated tests found while doing so:

- eventhubs/servicebus: create namespaces with --disable-local-auth true (tenant policy)
- sql (per_db_cmk, tdebyok): move from eastus2euap to westus2
- mysql BYOK: use westus2/westcentralus
- network: use `wait --created` instead of `--exists`
- vm: rbac false for secrets tests; update retired images (Win2022, Debian 12, WS2022 g2)
- storage: StorageV2 account with allow_shared_key_access=False
- batch BYOS and AKS app-routing keyvault tests re-recorded live

Unit tests (keyvault):
- Add CreateHsmV2SkuTest: create_hsm sends Standard_B1v2/B5v2/B10v2/B15v2/B20v2 with family 'B'
  (playback matches on URL only, so request bodies need unit coverage)
- CreateVaultSoftDeleteTest: patch keyvault.custom.sdk_no_wait so it does not depend on test order

Recordings are scrubbed of subscription IDs, object IDs, client IPs and personal resource names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
neerja581 and others added 2 commits October 28, 2026 13:51
Resolve conflict in test_aks_approuting_enable_with_keyvault_secrets_provider_addon_and_keyvault_id.yaml by taking upstream; AKS recordings re-recorded in a follow-up commit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
…U scenario test

- az keyvault list (no -g) and az vm secret format now use the 2015-11-01 pinned client so next-link pages keep a supported api-version.
- Add live test_keyvault_hsm_v2_sku (Standard_B1v2 create/show/list/delete/purge plus invalid-SKU rejection).
- Re-record AKS approuting keyvault tests after merging upstream dev.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

… scenario

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
@neerjagangwar

Copy link
Copy Markdown
Member Author

Addressed in 2e89d04 and e25f635. I added test_keyvault_hsm_v2_sku rather than extending test_keyvault_hsm_mgmt, so the default-SKU coverage stays as it is. It covers the Standard_B1v2 create/show checks and both error cases (see the _params.py thread). It was recorded live and passes in playback, along with test_create_hsm_v2_sku_request_body and test_keyvault_hsm_mgmt.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

pytest 9.2 stores a NodeId object in TestReport._id, which pytest-forked 1.7.5 cannot marshal, so every forked test exits with status 3. Serialize the public nodeid string instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Comment thread src/azure-cli-core/conftest.py Outdated
Comment thread src/azure-cli-telemetry/conftest.py Outdated
Comment thread src/azure-cli/conftest.py Outdated
neerja581 and others added 3 commits October 29, 2026 12:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

Comment thread src/azure-cli/azure/cli/command_modules/servicefabric/custom.py
…tired

Azure Media Services was retired on 30 June 2024, so this test can no longer be re-recorded live. Removed per review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c7bf1cdb-c782-4d93-bea0-7026027f9c87
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad act-observability-squad act-quality-productivity-squad Auto-Assign Auto assign by bot Batch az batch Graph (doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad KeyVault az keyvault NetAppFiles az netappfiles Request X Engineering Agent Ask the agent to triage this issue or review this PR Service Fabric az sf X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants